package com.car.service;

import com.car.dao.EmployeeDao;
import com.car.dao.impl.EmployeeDaoImpl;
import com.car.domain.Employee;

import java.util.Scanner;

public class EmployeeService {
    private static final EmployeeDao employeeDao = new EmployeeDaoImpl();

    public Employee login(Scanner scanner) throws Exception {
        System.out.println("员工登陆");
        System.out.println("请输入员工的 工号: ");
        String workId = scanner.next();
        System.out.println("请输入密码: ");
        String password = String.valueOf(employeeDao.findByWorkId(workId));
        Employee employee = null;
        if (employee == null || !"123456".equals(password)){
            System.out.println("登陆失败");
            return  null;
        }
        return employee;
    }
}
